#include <stdio.h> 
int main(){
	int n=0,i,j;
	char org[80];
	char trg;
	gets(org);
	trg = getchar();
	for(i=0;i<80;i++){
		if(org[i]==trg){
			n++;
		}
	}
	printf("%d",n);
}
